<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>vue事件的修饰符</title>
  <script src="/web1/js/vue.js"></script>
  <style> 
    .rect{
        display: flex;
        width: 400px;
        height: 200px;
        background-color: aquamarine;
    }
    .blue{
        background-color: blue;
        width: 100px;
        height: 100px;
    }


  </style>
</head>
<body>
  <div id="app">
    <!-- .stop修饰符阻止单击事件的继续传播，即阻止冒泡行为 -->
    <!-- 冒泡行为？就是连续触发事件称为冒泡 -->
    <div @click="divClick()">
        9999
        <button @click.stop="btnClick()">button</button>
    </div>

    <!-- .prevent修饰符 对某些DOM元素进行操作的时候，会有些默认行为。.prevent可以阻止这些默认行为 -->
    <form action="3-5.html">
        <input type="submit" value="提交" @click.prevent="inputClick()">
    </form>

    <!-- self修饰符 只监听自己元素的事件 -->
    <div class="rect" @click.self="alertAquamarine">
        <div class="blue" @click="alertBlue"></div>
    </div>

    <!-- .xx修饰符可以监听某个键帽的敲击 -->
    <input type="text" @keyup.R="keyup">

  </div>
<br>
  <script>
    let app = new Vue({
      el:"#app",
      data:{ 
        msg:'hello world'
      },
      methods: {
        divClick(){
            console.log("divClick");
        },
        btnClick(){
            console.log("btnClick");
        },
        inputClick(){
            console.log("inputClick");
        },
        alertAquamarine(){
            console.log("alertAquamarine");
        },
        alertBlue(){
            console.log("alertBlue");
        },
        keyup(){
            console.log("keyup");
        }

      },
    })
  </script>
</body>
</html>